package cn.tedu.seckill.consumer;

import java.util.Date;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cn.tedu.seckill.mapper.SecMapper;
import cn.tedu.seckill.mapper.SucMapper;

@Component
public class SendConsumer {
	@Autowired
	private SecMapper secMapper;
	@Autowired
	private SucMapper sucMapper;

	@RabbitListener(queues = { "seckillQ01" })
	public void seckillSuccess(String msg) {
		Long userPhone = Long.parseLong(msg.split("/")[0]);
		Long seckillId = Long.parseLong(msg.split("/")[1]);
		Date nowTime = new Date();
		int result = secMapper.updateNum(seckillId, nowTime);
		if (true) {
			System.out.println("失败");
		}
		
	}
}
